#!/bin/bash -il
CODE_BASE_DIR=/var/jenkins_home/workspace/matecloud-v1/
NAME_GATEWAY=mate-gateway
NAME_UAA=mate-uaa
NAME_SYSTEM=mate-platform/mate-system
NAME_SYSTEM_NAME=mate-system
NAME_COMPONENT=mate-platform/mate-component
NAME_COMPONENT_NAME=mate-component

pwd

echo "pull code..."
cd ${CODE_BASE_DIR}
echo "checkout code..."


echo "maven clean install..."
mvn clean install -Dmaven.javadoc.skip=true -Dgpg.skip

##docker打包镜像

cd ${CODE_BASE_DIR}/${NAME_GATEWAY}/
echo "begin build gateway images..."
mvn package docker:build -Dmaven.test.skip=true
echo "success build gateway images..."

cd ${CODE_BASE_DIR}/${NAME_UAA}/
echo "begin build uaa images..."
mvn package docker:build -Dmaven.test.skip=true
echo "success build uaa images..."

cd ${CODE_BASE_DIR}/${NAME_SYSTEM}/
echo "begin build system images..."
mvn package docker:build -Dmaven.test.skip=true
echo "success build system images..."

cd ${CODE_BASE_DIR}/${NAME_COMPONENT}/
echo "begin build component images..."
mvn package docker:build -Dmaven.test.skip=true
echo "success build component images..."